package servlet.zhouchao;

import pojo.Goods;
import pojo.GoodsClass;
import service.GoodsClassService;
import service.GoodsService;
import service.impl.GoodsClassServiceImpl;
import service.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(value = "/GoodsClassModifyServlet")
public class GoodsClassModifyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String clId=request.getParameter("clId");
        if(null==clId || "".equals(clId)){
            //参数异常直接返回原界面
            request.getRequestDispatcher("GoodsClassPageBeanListServlet").forward(request,response);
        }else {
            //调用商品编号查询商品信息
            GoodsClassService goodsClassService = new GoodsClassServiceImpl();
            GoodsClass goodsClass = goodsClassService.queryGoodsClassInfo(Integer.parseInt(clId));
            request.setAttribute("goodsClass", goodsClass);
            request.getRequestDispatcher("jsp/zc/GoodsClassModify.jsp").forward(request,response);

        }

            /*// 查询所有商品分类信息
            GoodsClassService goodsClassService=new GoodsClassServiceImpl();
            List<GoodsClass> list= goodsClassService.queryAll();
            request.setAttribute("List",list);*/

    }
}
